#include "SqlOperation.h"
#include "ConnObject.h"

SqlOperation::SqlOperation(const std::string &sql):sql_(sql)
{
}

SqlOperation::~SqlOperation()
{
}

std::future<std::unique_ptr<sql::ResultSet>> SqlOperation::GetFuture()
{
    return promise_.get_future();
}

void SqlOperation::ExecuteSql(ConnObject *connObj)
{
    auto result = connObj->QueryDatabase(sql_);
    //创建共享指针
    promise_.set_value(std::unique_ptr<sql::ResultSet>(result));
}
